//
//  DDShareAccountTableViewCell.m
//  DingDongZP
//
//  Created by 杨政涛 on 16/10/17.
//  Copyright © 2016年 51ledian.com. All rights reserved.
//

#import "DDShareAccountTableViewCell.h"

@implementation DDShareAccountTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self){
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        self.nameLabel = [[UILabel alloc]init];
        self.nameLabel.textColor = COLOR_FONT_BLACK;
//        self.nameLabel.font = [UIFont systemFontOfSize:16];
        self.nameLabel.adjustsFontSizeToFitWidth = YES;
        [self.contentView addSubview:self.nameLabel];
        
        self.phoneLabel = [[UILabel alloc]init];
        self.phoneLabel.textColor = COLOR_FONT_BLACK;
        self.phoneLabel.font = [UIFont systemFontOfSize:16];
        self.phoneLabel.textAlignment = 2;
        [self.contentView  addSubview:self.phoneLabel];
        
        UIImageView *rightPic = [[UIImageView alloc]init];
        rightPic.image = [UIImage imageNamed:@"箭头"];
        [self.contentView  addSubview:rightPic];

        
        WEAKSELF
        [rightPic mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.centerY.mas_equalTo(weakSelf);
            make.right.mas_equalTo(weakSelf).offset(-15);
            make.width.equalTo(@(10));
            make.height.equalTo(@(13));
        }];
        
        [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.mas_equalTo(weakSelf).offset(15);
            make.left.mas_equalTo(weakSelf).offset(20);
            make.right.mas_equalTo(weakSelf).offset(-160);
            make.bottom.mas_equalTo(weakSelf).offset(-15);

        }];
        
        [self.phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.top.bottom.mas_equalTo(weakSelf);
            make.left.mas_equalTo(self.nameLabel.mas_right).offset(10);
            make.right.mas_equalTo(rightPic.mas_left).offset(-10);
        }];
    }
    return self;
}

- (void)setDataModel:(DDShareAccountListModel *)dataModel
{
    self.nameLabel.text = dataModel.remark;
    self.phoneLabel.text = dataModel.mobile;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
